home *** CD-ROM | disk | FTP | other *** search
- /*
-
- Nullsoft WASABI Source File License
-
- Copyright 1999-2001 Nullsoft, Inc.
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
-
- Brennan Underwood
- brennan@nullsoft.com
-
- */
-
- #ifndef _EXAMPLE1WND_H
- #define _EXAMPLE1WND_H
-
- #include "../common/virtualwnd.h"
- #include "../common/SimpleWndCreate.h"
- #include "../common/nsGUID.h"
-
- #define EXAMPLE1WND_PARENT VirtualWnd
- //
- // Well, great. Now that we have that whole "PARENT" thing straightened out,
- // let's define the class we're going to be using in our first happy example.
- class Example1Wnd : public EXAMPLE1WND_PARENT {
-
- public:
- // This public enum allows us to decide at runtime if the object that we're
- // instantiating will paint itself in a boring or exciting manner.
- typedef enum {
- BORING,
- EXCITING
- } BlitStyle;
-
- public:
- // And make a pair of constructors that let us set the default blitstyle value
- // Or specify it upon allocation & construction.
- Example1Wnd( BlitStyle style = BORING ) :
- myBlitStyle( style ),
- EXAMPLE1WND_PARENT() { }
-
- // And, then, here are the virtual methods we'll be overriding to get our
- // little window to be painting prettily on its little canvas. Woot!
- virtual int onPaint(Canvas *canvas);
- virtual void timerCallback(int id);
- virtual int onInit();
- // We'll cover these methods as we implement them in the CPP file.
-
-
-
- // =========================================================================
- //
- // These static methods must be provided in order to use this object
- // as a WindowCreationObject in the SimpleWndCreate template. The ExampleB
- // project shows a way to implement these statics upon your component obj.
- //
- // In this example, we're implementing these methods on this window class
- // itself. Furthermore, because we reuse this Example1 window class IN
- // ExampleB, we cannot assume a single instance of this object to ever be
- // resident (and thus cannot use the "Main()" method implemented on the
- // ExampleB component to thunk from a static call to the single instance).
- //
- // Complicated, eh?
- //
- // Well, not really... just the slightly-more-complicated version living
- // in the earlier project rather than the later one. Sorry.
- //
- static const char *getWindowNameStatic();
- static GUID getGUIDStatic();
- static RootWnd *createWindowStatic(int n, RootWnd *parentWnd);
- static int destroyWindowStatic(RootWnd *deadWnd);
- static ThingerBitmapInfo getThingerBitmapInfoStatic();
- // =========================================================================
-
- static BlitStyle getNextBlitStyle();
-
- protected:
- // How did I want to draw myself today?
- BlitStyle myBlitStyle;
- // There's nothing quite as useless as code that displays how to implement
- // the functionality of "Look different the next time you're opened" !!
- static BlitStyle nextBlitStyle;
-
- // I assign a GUID to this window class, to allow it to be accessible
- // through the window creation services.
- static GUID myWindowClassGUID;
- // And here we're just going to write down what pointers we created, in
- // order to ensure that we delete them and only them.
- static PtrList< Example1Wnd > createdWindows;
- };
-
- #endif _EXAMPLE1WND_H
-